package com.slixils.demo.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @Author: JinChongLi
 * @Description:
 * @Date: Created in 2:05 2022/4/5
 * @Modified By:
 */
@Data
@AllArgsConstructor
public class RespBean {
    private Long code;
    private String message;
    private Object obj;

    public static RespBean success() {
        return new RespBean(Long.valueOf(RespBeanEnum.SUCCESS.getCode()),
                RespBeanEnum.SUCCESS.getMessage(), null);
    }

    /**
     * @param obj
     * @return
     */
    public static RespBean success(Object obj) {
        return new RespBean(Long.valueOf(RespBeanEnum.SUCCESS.getCode()), RespBeanEnum.SUCCESS.getMessage(), obj);
    }
    public static RespBean error(RespBeanEnum respBeanEnum) {
        return new RespBean(respBeanEnum.getCode(), respBeanEnum.getMessage(), null);
    }

    public static RespBean error(RespBeanEnum respBeanEnum, Object object) {
        return new RespBean(respBeanEnum.getCode(), respBeanEnum.getMessage(), object);
    }

    public RespBean(long code, String message, Object object) {
        this.code = code;
        this.message = message;
        this.obj = object;
    }

    public RespBean(){

    }
}
